<template>
  <el-dialog :visible.sync="value" :before-close="cancel">
    <template slot="title">详情</template>
    <el-form  :label-width="formLabelWidth">
      <el-form-item label="订单号:" prop="conditionName">
        <span>{{form.orderId || '--'}}</span>
      </el-form-item>
     <el-form-item label="状态:" prop="status">
        <span>{{form.status==0?'成功':(form.status==1?'失败':(form.status==2?'处理中':'--'))}}</span>
      </el-form-item>
      <!-- <el-form-item label="数据库订单状态:" prop="dbStatus">
        <span>{{form.dbStatus==0?'成功':(form.dbStatus==1?'其他':'--')}}</span>
      </el-form-item> -->
      <el-form-item label="三方交易号:" prop="thirdOrderId">
        <span>{{form.thirdOrderId || '--'}}</span>
      </el-form-item>
      <el-form-item label="成功金额:" prop="amount">
        <span>{{form.amount || '--'}}</span>
      </el-form-item>
      <el-form-item label="成功时间:" prop="successTime">
        <span>{{form.successTime || '--'}}</span>
      </el-form-item>
      <el-form-item label="出款商户ID:" prop="merchantId">
        <span>{{form.merchantId || '--'}}</span>
      </el-form-item>
      <el-form-item label="出款商户名称:" prop="merchantName">
        <span>{{form.merchantName || '--'}}</span>
      </el-form-item>
      <el-form-item label="出款商户号:" prop="merchantCode">
        <span>{{form.merchantCode || '--'}}</span>
      </el-form-item>
      <el-form-item label="备注:" prop="remark">
        <span>{{form.remark || '--'}}</span>
      </el-form-item>
      <el-form-item v-if="form.status==2">
       <el-button @click="toMarkFail" type="primary" style="position:relative;right:80px;top:20px">置为失败</el-button>
      </el-form-item>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button @click="cancel">取 消</el-button>
      <el-button type="primary" @click="cancel" :loading="loading">确 定
      </el-button>
    </div>
  </el-dialog>
</template>

<script>

import { form } from '@/build';
import { checkInfoApi, markFail } from '@/services/api/withdraw';


export default {
  name: 'check-info',
  mixins: [form],
  props: ['value', 'orderId'],
  data() {
    return {
      formLabelWidth: '150px',
      form: {},
    };
  },
  mounted() {
    this.bindGet(checkInfoApi, 'form', {
      beforeSend: data => ({
        orderId: this.orderId,
      }),
    });
    this.getAll();
    this.bindGet(markFail, '', {
      action: 'tomarkFail',
      beforeSend: data => ({
        orderId: this.orderId,
      }),
      afterSuccess: () => {
        // this.getAll();
        this.$message({
          message: '操作成功',
          type: 'success'
        })
        this.cancel();
      },
    });
  },
  methods: {
    cancel() {
      this.$emit('input', false);
      this.$parent.getAll();
    },
    toMarkFail() {
      this.doGet({ action: 'tomarkFail' });
    },
  },

};
</script>

<style lang="scss" scoped>
  .tips{
    color: #888888;
  }
</style>
